

    <div class="content">
        <div class="header">
            
            <h1 class="page-title">ユーザ一覧</h1>
                    <ul class="breadcrumb">
            <li><a href="<?php echo $this->config->base_url('index.php/user/list_user/');?>">ホームページ</a> </li>
            <li class="active">ユーザ一覧</li>
        </ul>

        </div>
        <div class="main-content">
            
<div class="btn-toolbar list-toolbar">
    <a href="<?php echo $this->config->base_url('index.php/user/create_user/');?>" class="btn btn-primary"><i class="fa fa-plus"></i> 登録&nbsp;</a>
    <a href="<?php echo $this->config->base_url('index.php/user/csv_import/');?>" class="btn btn-default">インポート</a>
    <a href="<?php echo $this->config->base_url('index.php/user/csv_export/');?>" class="btn btn-default">エクスポート</a>
  <div class="btn-group">
  </div>
</div>
<?php //if(count($data)){?>
<table class="table">
  <thead>
    <tr>
      <th style="color: #428bca">会社名</th>
      <th style="color: #428bca">使用者名</th>
      <th style="color: #428bca">住所</th>
      <th style="color: #428bca">メールアドレス</th>
      <th style="color: #428bca">ログイン名</th>
      <th style="width: 4.5em;"></th>
    </tr>
  </thead>
  <tbody>
  <?php foreach ($data as $user){?>
    <tr>
      <td><?php echo $user['company_name']?></td>
      <td><?php echo $user['username']?></td>
      <td>
      <?php echo $user['address1']?><br>
      <?php echo $user['address2']?>
      </td>
      <td><?php echo $user['mail']?></td>
      <td><?php echo $user['login_name']?></td>
      <td>
          <a href="<?php echo $this->config->base_url('index.php/user/user_profile/'.$user['id']);?>" role="button" data-toggle="modal"><i class="fa fa-file-text"></i></a>
          <a href="<?php echo $this->config->base_url('index.php/user/edit_user/'.$user['id']);?>"><i class="fa fa-pencil"></i></a>
          <a href="#myModal" class="delete_btn_icon" ui-delete="<?php echo $user['id']?>" role="button" data-toggle="modal"><i class="fa fa-trash-o"></i></a>
      </td>
    </tr>
    <?php }?>
  </tbody>
</table>
<?php //echo $this->pagination->create_links ();?>
<!-- <ul class="pagination"> -->
<!--   <li><a href="#">&laquo;</a></li> -->
<!--   <li><a href="#">1</a></li> -->
<!--   <li><a href="#">2</a></li> -->
<!--   <li><a href="#">3</a></li> -->
<!--   <li><a href="#">4</a></li> -->
<!--   <li><a href="#">5</a></li> -->
<!--   <li><a href="#">&raquo;</a></li> -->
<!-- </ul> -->

<?php //} else {?>
<!-- <div>データがありません。</div> -->
<?php //}?>
<div class="modal small fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">削除確認</h3>
        </div>
        <div class="modal-body">
            <p class="error-text"><i class="fa fa-warning modal-icon"></i>選択したユーザを削除しますか?</p>
        </div>
        <div class="modal-footer">
            <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">キャンセル</button>
            <button id="delete_btn" class="btn btn-danger" data-dismiss="modal">削除</button>
        </div>
      </div>
    </div>
</div>
    <script type="text/javascript">
        $(function() {
            $('.delete_btn_icon').click(function(){
//             	var r = confirm("選択したユーザを削除しますか?");
//             	if (r == true) {
                    var user_id = $(this).attr( 'ui-delete' );
                    $('#delete_btn').click(function(){
                      jQuery.ajax({
                          type: "post",
                          url: "<?php echo $this->config->base_url('index.php/user/delete_user/');?>",
                          data: {user_id: user_id},
                          success:function(respone){
                              if(respone){
                                  //alert("User has been delete");
                                  location.reload(true);
                              }else{
                            	  alert("エラー");
                              }
                          }
                      });
                    });
//             	} else {
//             	}
                });
            $('.table').dataTable(
            	    {
            		     "language": {
             		    	 "zeroRecords": "データがありません。",
              		    	 "sLengthMenu": " _MENU_件表示 ",
             		    	 "sSearch": "検索:",
              		         "paginate": {
             		        	  "sNext": "次へ",
             		        	  "sPrevious": "前へ"
            		          },
            		          "sInfo": " _TOTAL_ 件中　_START_ ～ _END_ を表示",
            		          "sInfoEmpty": "0 件中　0 ～ 0　を表示",
            		          "sInfoFiltered": "(全 _MAX_ 件中)",
          		    	  }
            	    }
                    );
        });
    </script>



